package org.xb.SimpleStrategyPatternAndFactpry;

/**
 * @Author
 * @Description
 * @Date created in 16:13 2023/12/5
 */
public class CashContext {
    private CashSuper cs;

    public CashContext(String type){
        switch (type){
            case "正常收费":
                cs = new CashNormal();
                break;
            case "满300减100":
                cs = new CashReturn(300d,100d);
                break;
            case "8折":
                cs = new CashRebate(0.8);
                break;
        }
    }
    public double getResult(double money){
        return cs.acceptCash(money);
    }


}
